require 'test/unit'

require 'models/account'
class AccountTest < Test::Unit::TestCase
    def test_acceptable_name
        assert_raise(RuntimeError){Account.acceptable_name?("")}
        assert_raise(RuntimeError){Account.acceptable_name?("      ")}
        assert_raise(RuntimeError){Account.acceptable_name?("1")}
        assert_raise(RuntimeError){Account.acceptable_name?("abc1")}
        assert_raise(RuntimeError){Account.acceptable_name?("abc def")}
        assert_raise(RuntimeError){Account.acceptable_name?("#")}
        assert_raise(RuntimeError){Account.acceptable_name?("xx$Aragorn%xx")}
        assert_raise(RuntimeError){Account.acceptable_name?("a")}
        assert_raise(RuntimeError){Account.acceptable_name?("ab")}
        assert_raise(RuntimeError){Account.acceptable_name?("_MrChucho")}

        assert(Account.acceptable_name?("abc"))
        assert(Account.acceptable_name?("MrChucho"))
        assert(Account.acceptable_name?("Mr_Chucho"))
    end
end
